package cn.source.zk.domain.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;


@Data
@AllArgsConstructor
public class ComprehensiveData {
    private Date timestamp;

    // 基础数据存储（字段名:值）
    private Map<String, Object> baseMetrics = new HashMap<>();

    // 谐波次数存储（表名: {谐波次数:值}）
    private Map<String, Map<Integer, Double>> harmonics = new HashMap<>();

    // 间谐波存储（表名: {谐波次数:值}）
    private Map<String, Map<Integer, Double>> interharmonics = new HashMap<>();

    // 构造方法
    public ComprehensiveData(Date timestamp) {
        this.timestamp = timestamp;
    }

    // 添加基础数据字段
    public void addBaseMetric(String fieldName, Object value) {
        baseMetrics.put(fieldName, value);
    }

    // 添加谐波数据
    public void addHarmonicData(String tableName, int order, Double value) {
        harmonics.computeIfAbsent(tableName, k -> new HashMap<>()).put(order, value);
    }

    // 添加间谐波数据
    public void addInterharmonicData(String tableName, int order, Double value) {
        interharmonics.computeIfAbsent(tableName, k -> new HashMap<>()).put(order, value);
    }
}
